home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
dskut
/
cachemon.zip
/
CACHEMON.DOC
< prev
next >
Wrap
Text File
|
1990-03-14
|
6KB
|
146 lines
CACHEMON - Disk cache monitor
Copyright (c) 1990 D.J. Murdoch. See the license notice below.
Purpose
CACHEMON is a set of 3 programs to monitor disk activity. I
wrote them to check up on a couple of disk cache programs that I
was testing.
Use
The basic method is to load a copy of CACHEMON, then your disk
caching software, then another copy of CACHEMON. (Each takes at
most a few hundred bytes, so it doesn't cost you much memory to
load two.) How you load them depends on the type of disk cache.
If a software cache is loaded as a device driver, then you can
load a copy of CACHEMON ahead of it by using the device driver
CACHEMON.BIN. In your config.sys file, before the cache is
loaded, put a line like
DEVICE=CACHEMON.BIN [name]
The name is optional, and is only used to label this monitor in
reports.
A good choice of name is something like "Physical", since this
monitor is loaded before the cache program, and it will see the
actual hardware read/write requests - the ones that couldn't be
satisfied from the cache.
To see how many software read requests there were, you need to
load another copy sometime after the cache program. This can
usually (but not necessarily) be just another line in CONFIG.SYS
after the line for the cache; however, you may find that a
monitor loaded that way sees only the hardware requests. If so,
be sure to activate the cache, and then use the TSR CACHEMON.COM
method described below.
If the software cache is loaded as a TSR (memory resident)
program from a batch file or the command line, then the second
monitor must be loaded as a TSR as well. (The first monitor
could also be loaded as a TSR before the cache.) To do this,
just run the command
CACHEMON [name]
from the batch file after the cache has been activated, or from
the command line. CACHEMON will remain resident in memory until
you reboot or use a TSR controller (such as MARK/RELEASE, from
Turbopower) to remove it.
At this point, you'll have two monitors in memory, but they'll be
slightly out of synchronization, because the first one will have
counted all the accesses that took place after it was loaded and
before the second one was loaded. To synchronize them, run the
CACHEREP report program, with the reset option:
CACHEREP /R
and you should see a two line report of disk accesses. After
printing the report, CACHEREP resets both monitors to 0, and
they'll continue from there.
There's nothing to stop you from loading more monitors after the
first two (though the present version of CACHEREP can only report
on 10); if you use a multitasker like Desqview, you might want to
load the first two before DV, and then more as TSRs within each
window. The first two will be visible from all windows and will
count all disk requests, while the rest will only be visible from
the window where they were loaded, and will only monitor disk
requests coming from that window.
At any time after loading the monitors, you can print a report by
running CACHEREP with or without the reset option. It tries to
identify the last monitor as the one with the highest read count,
and expresses all other counts relative to this monitor in the
"percent" columns.
Limitations and bugs
To detect how many disk read/write requests are not being
satisfied from a cache, you must load a copy of CACHEMON before
the cache program. This means if you're trying to evaluate a
hardware cache, there's no way CACHEMON can help.
To detect how many read requests have been made, you need a copy
between the requestor and the cache program. This means CACHEMON
is no use if you're trying to evaluate how DOS buffers affect
disk access, since it hooks into the BIOS disk accesses, after
any effect of BUFFERS has taken place.
As presently coded, only access to the first hard disk (BIOS
device number 80h) are monitored. However, as you'll see in the
source code, there's a byte called "my_id" which determines the
disk number; change it if you like, or modify CACHEREP to make
the change dynamically.
The device driver version creates a character device called
CACHE$$$. This effectively blocks access to files and previously
loaded device drivers with the same name. You can change the
name as you like; it isn't used when the program is running. If
you do happen to try to access this device, you'll get a "device
not ready" critical error; abort the attempt and no damage should
have been done.
Source Code
Complete source code for all three programs should be included in
this package, along with the makefile I used to compile/assemble
them. The two monitors are written in A86 assembler, with source
code in the files DEV_HEAD.A86, MONITOR.A86 and DEV_TAIL.A86 (for
CACHEMON.BIN), and MONITOR.A86 and TSR_TAIL.A86 for CACHEMON.COM.
The reporting program is written in Turbo Pascal 5.5, and uses
the Turbopower Object Professional library for Boyer-Moore search
and pointer manipulation routines. Subject to the license below,
you're free to do as you like with the code.
License
You may use this program and the source code for any non-
commercial purpose at no charge. Commercial users must obtain a
license at a cost of $25 Canadian per user, from me at the
address below.
Warning
While I tried to be sure these programs wouldn't cause any
problems, the variety of hardware and software in the PC world
these days almost guarantees that they won't work for someone.
Therefore, I can't give any guarantees or accept any liability
for damage that they may cause. I would appreciate reports of
any bugs that people find.
Duncan Murdoch
Department of Statistics and Actuarial Science
University of Waterloo
Waterloo, Ontario, Canada N2L 3G1
(519)-888-4731
Internet: dmurdoch@watstat.waterloo.edu
Fidonet: DJ Murdoch at 1:221/180.4
Compuserve: 71631,122